package com.ideabove.heart.custom;

import com.ideabove.heart.R;
import com.ideabove.heart.util.LogUtil;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;

public class PayCloset extends FreeCloset{

	public boolean isPaid;
	Bitmap ribon;
	
	public String cashId;
	
	public PayCloset(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
		
		ribon = BitmapFactory.decodeResource(getResources(), R.drawable.ribbon_small);

		cashId = context.obtainStyledAttributes( attrs, R.styleable.FreeCloset )
				.getString( R.styleable.FreeCloset_cashid);

	}
	
	@Override
	protected void drawSelf(Canvas canvas){
		// 모닝콜 오픈 날짜에 따라 배경색을 몰로 할지를 결정한다.
		
		if(isPaid){			
			if(openBg != null){
				Rect src = new Rect(0,0,openBg.getWidth(),openBg.getHeight());
				Rect dst = new Rect(0,0,getWidth(),getHeight());			
				canvas.drawBitmap(openBg, src, dst, null);
			}
			
			
		}else{
			if(openBg != null){
				Rect src = new Rect(0,0,closeBg.getWidth(),closeBg.getHeight());
				Rect dst = new Rect(0,0,getWidth(),getHeight());			
				canvas.drawBitmap(closeBg, src, dst, null);
				
				canvas.drawBitmap(ribon, 0, 0, null);
			}
		}
		
		if(isFocus){
			Rect src = new Rect(0,0,focusBg.getWidth(),focusBg.getHeight());
			Rect dst = new Rect(0,0,getWidth(),getHeight());			
			canvas.drawBitmap(focusBg, src, dst, null);
		}
	}

	@Override
	protected void onDraw(Canvas canvas) {
		// TODO Auto-generated method stub
		
		super.onDraw(canvas);	
	}
	
	

}
